package net.wanglu.www.zzz.main;

import java.text.SimpleDateFormat;

import org.apache.commons.configuration.PropertiesConfiguration;

public class Configer {
	
	private static PropertiesConfiguration SystemProperties = null;
	public static SimpleDateFormat DF = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");	
	private static Configer configer = new Configer();
	
	public static Configer getConfiger() {
		return configer;
	}
	
	public String getProperty(String key) {
		return SystemProperties.getString(key);
	}

	public void setProperty(String key, String value) {
		SystemProperties.setProperty(key, value);
	}
	
	public String[] getSpring() {
		return SystemProperties.getStringArray("Spring");
	}

	public String getLog4j() {
		return SystemProperties.getString("Log4j");
	}

	public String getMainPath() {
		return SystemProperties.getString("MainPath");
	}

	public static void loadProperties(String configPath) throws Exception {
		
		SystemProperties = new PropertiesConfiguration(configPath);
	}
	
	public static void updateProperties() throws Exception {
		// TODO Auto-generated method stub
		SystemProperties.save();
	}
}
